// import storage from '@/utils/storage'

const History = {
  _history: [],
  install (Vue) {
    Object.defineProperty(Vue.prototype, '$history', {
      get () {
        return History
      }
    })
  },
  push (path) {
    this._history.push(path)
  },
  pop () {
    this._history.pop()
  },
  canBack () {
    return this._history.length > 1
  }
}

/* Object.defineProperty(History, 'history', {
  get () {
    this._history = storage.getItem('history')
    return this._history
  },
  set (path) {
    const history = storage.getItem('history')
    if (!path) {
      history.splice(history.length - 1, 1)
    } else {
      history.push(path)
    }
    storage.setItem('history', history)
  }
}) */

export default History
